package com.ljx.itbbs.server.article.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ljx.itbbs.server.article.domain.entity.ArticleTagEntity;
import com.ljx.itbbs.server.article.mapper.ArticleTagMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleTagDao extends ServiceImpl<ArticleTagMapper, ArticleTagEntity> {

    public List<ArticleTagEntity> getByContents(List<String> tagList) {
        return lambdaQuery().in(ArticleTagEntity::getContent, tagList).list();
    }

    public void saveArticleTags(List<String> res) {
        this.baseMapper.saveArticleTags(res);
    }

    public ArticleTagEntity getByContent(String tag) {
        return lambdaQuery().eq(ArticleTagEntity::getContent, tag).one();

    }
}
